@props([
    'variant' => 'default',
    'size' => 'normal',
    'type' => 'button',
    'disabled' => false,
    'href' => null,
    'icon' => '',
    'iconPosition' => 'left'
])

@php
    $baseClasses = 'btn';
    
    $variantClasses = match($variant) {
        'primary' => 'btn-primary',
        'secondary' => 'btn-secondary',
        'accent' => 'btn-accent',
        'success' => 'btn-success',
        'info' => 'btn-info',
        'warning' => 'btn-warning',
        'error' => 'btn-error',
        'ghost' => 'btn-ghost',
        'link' => 'btn-link',
        'outline' => 'btn-outline',
        default => ''
    };
    
    $sizeClasses = match($size) {
        'xs' => 'btn-xs',
        'sm' => 'btn-sm',
        'lg' => 'btn-lg',
        'block' => 'btn-block',
        default => ''
    };
    
    $classes = trim("{$baseClasses} {$variantClasses} {$sizeClasses} " . ($attributes->get('class') ?? ''));
@endphp

@if($href)
    <a href="{{ $href }}" {{ $attributes->merge(['class' => $classes]) }}>
        @if($icon && $iconPosition === 'left')
            {!! $icon !!}
        @endif
        {{ $slot }}
        @if($icon && $iconPosition === 'right')
            {!! $icon !!}
        @endif
    </a>
@else
    <button type="{{ $type }}" {{ $attributes->merge(['class' => $classes]) }} {{ $disabled ? 'disabled' : '' }}>
        @if($icon && $iconPosition === 'left')
            {!! $icon !!}
        @endif
        {{ $slot }}
        @if($icon && $iconPosition === 'right')
            {!! $icon !!}
        @endif
    </button>
@endif 